﻿@inherits AdminCompontentBase

<SAutoComplete Small TItem="UserSelectModel"
               TValue="Guid?"
               TItemValue="Guid"
               Value="Value"
               ValueChanged=ValueChanged
               Items="Items"
               OnSearchInputUpdate="OnSearchChanged"
               HideDetails="@("auto")"
               BackgroundColor="white"
                  Clearable
               ItemText="u=>TextView(u)"
               ItemValue="u=>u.Id"
               Filter="(item,search,value) => true"
               Label="@Label"
               Class="@($"{Class} rounded-2")"
               Placeholder="@Placeholder"
               OnClearClick="OnClearClick"
               OnSelectedItemUpdate="OnSelectedItemUpdate">
    <ItemContent Context="data">
        <div class="d-flex py-2" style="height:64px;">
            @if (string.IsNullOrEmpty(data.Item.Avatar))
            {
                <SEmptyAvatar Class="ma-auto" Size=30 Value="@(data.Item.Name)" />
            }
            else
            {
                <MAvatar Size=30 Class="ma-auto">
                    <img src="@data.Item.Avatar" />
                </MAvatar>
            }
            <div class="ma-auto ml-2">
                <div class="d-flex">
                    <span class="Body2 emphasis2--text">@data.Item.Name</span>
                    <div class="d-inline-flex mx-2" style="height: 8px">
                        <MDivider Vertical />
                    </div>
                    <span class="body2 regular2--text">@(data.Item.DisplayName)</span>
                    <div class="my-auto mx-2" style="width: 0px;height: 8px;border: 1px solid #E2E7F4;"></div>
                    <span class="btn emphasis2--text">@data.Item.PhoneNumber</span>
                </div>
                <div class="d-flex">
                    <span class="overline regular3--text">@data.Item.Account</span>
                    @if (!string.IsNullOrEmpty(data.Item.Account) && !string.IsNullOrEmpty(data.Item.Email))
                    {
                        <div class="my-auto mx-2" style="width: 0px;height: 8px;border: 1px solid #E2E7F4;"></div>
                    }
                    <span class="overline regular3--text">@data.Item.Email</span>
                </div>
            </div>
        </div>
    </ItemContent>
</SAutoComplete>